package com.zyg.dao;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.zyg.pojo.Hostel;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface HostelMapper extends BaseMapper<Hostel> {
    @Select(" select  *  from hostel")
    List<Hostel> getHostelList();

    @Override
    @Select("select hostel_id,hostel_name,student_id from hostel ${ew.customSqlSegment}")
    @Results({
            @Result(property = "hostelId", column = "hostel_id"),
            @Result(property = "hostelName", column = "hostel_name"),
//            @Result(property = "student", column = "student_id", javaType = Hostel.class,
//                    one = @One(select = "com.zyg.dao.StudentMapper.getStudentById"))
    })
    List<Hostel> selectList(IPage<Hostel> page, @Param(Constants.WRAPPER) Wrapper<Hostel> queryWrapper);
    
}
